﻿@model App.Web.ViewModels.StoreViewModel
@using App.Web.Utility;
@using App.Core.Extensions;

@{
	String pageTitle = "Edit Store";
    if (Model != null && Model.ID == 0)
    {             
        pageTitle = "Add New Store";
    }
    ViewBag.Title = Html.GetPageTitle(pageTitle);    
}
<div class="page-heading">
    <h1>@pageTitle</h1>
    <div>
        Enter necessary information and then click the Save button.        
    </div>
</div>

@Html.JavaScript("jquery.validate.min.js", Url)
@Html.JavaScript("jquery.validate.unobtrusive.min.js", Url)

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

	if (Model == null)
    {
        @: @Html.ErrorMessageBox("Sorry! Requested Store was not found for edit.")
    }
	else
	{
		<div class="GroupBox">
			<div class="GroupHeaderOverlay" style="width:140px;">Store Information</div>    

			@Html.HiddenFor(model => model.ID)

			<div class="editor-label">
				@Html.LabelFor(model => model.Address)
			</div>
			<div class="editor-field">
				@Html.EditorFor(model => model.Address)
				@Html.ValidationMessageFor(model => model.Address)
			</div>
			<div class="editor-label">
				@Html.LabelFor(model => model.Phone)
			</div>
			<div class="editor-field">
				@Html.EditorFor(model => model.Phone)
				@Html.ValidationMessageFor(model => model.Phone)
			</div>
			<div class="editor-label">
				@Html.LabelFor(model => model.InCharge)
            </div>
			<div class="editor-field">
				@Html.DropDownListFor(model => model.InCharge, BindSelectList.CompanyUser(SessionCache.CurrentUser.Company.ID)) 
                @Html.ValidationMessageFor(model => model.InCharge)
			</div>
			@*@Html.HiddenFor(model => model.CreatedOn)
			@Html.HiddenFor(model => model.ModifiedOn)*@
			<div class="editor-label">
				@Html.LabelFor(model => model.IsActive)
			</div>
			<div class="editor-field">            
                @Html.RadioButtonFor(model => model.IsActive, "true", new { id = "rdnIsActive_1" }) <label for="rdnIsActive_1">Yes</label>
                @Html.RadioButtonFor(model => model.IsActive, "false", new { id = "rdnIsActive_0" }) <label for="rdnIsActive_0">No</label>
                @Html.ValidationMessageFor(model => model.IsActive)
            </div>
			<div class="editor-label">
				@Html.LabelFor(model => model.WeeklyCloseDay)
			</div>
			<div class="editor-field">
				@Html.EditorFor(model => model.WeeklyCloseDay)
				@Html.ValidationMessageFor(model => model.WeeklyCloseDay)
			</div>
			<div class="editor-label">
				@Html.LabelFor(model => model.StoreDetails)
			</div>
			<div class="editor-field">
				@Html.EditorFor(model => model.StoreDetails)
				@Html.ValidationMessageFor(model => model.StoreDetails)
			</div>
			<div>
				<input type="submit" value="Save" /> @Html.ActionLink("Back to List", "List")
			</div>
		</div>
	}
}

